package chapter07.h7_2;

public class TextBuilder extends Builder {
    private StringBuffer stringBuffer = new StringBuffer();

    @Override
    protected void buildTitle(String title) {
        stringBuffer.append("======================\n");
        stringBuffer.append("[" + title + "]\n");
        stringBuffer.append("\n");
    }

    @Override
    protected void buildString(String str) {
        stringBuffer.append("::" + str + "\n");
        stringBuffer.append("\n");
    }

    @Override
    protected void buildItems(String[] items) {
        for (int i = 0; i < items.length; i ++){
            stringBuffer.append("." + items[i] + "\n");
        }
        stringBuffer.append("\n");
    }

    @Override
    protected void buildDone() {
        stringBuffer.append("======================\n");
    }

    public String getResult(){
        return stringBuffer.toString();
    }
}
